var IE = (navigator.appName.toLowerCase() != "netscape");

function getPageSize()
{
    var de = document.documentElement;
    var w  = window.innerWidth  || self.innerWidth  || (de&&de.clientWidth)  || document.body.clientWidth;
    var h  = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;

    arrayPageSize = new Array(w,h);
    return arrayPageSize;
}

function getImageSizeToFitPageSize(imageWidth, imageHeight)
{
    var pagesize = getPageSize();
    var x = pagesize[0];
    var y = pagesize[1];
    
    if (imageWidth > x)
    {
        imageHeight = imageHeight * (x / imageWidth); 
        imageWidth  = x; 
        if (imageHeight > y)
        { 
            imageWidth  = imageWidth * (y / imageHeight); 
            imageHeight = y; 
        }
    } 
    else if (imageHeight > y)
    { 
        imageWidth  = imageWidth * (y / imageHeight); 
        imageHeight = y; 
        if (imageWidth > x)
        { 
            imageHeight = imageHeight * (x / imageWidth); 
            imageWidth  = x;
        }
    }

    arrayImageSize = new Array(imageWidth,imageHeight);
    return arrayImageSize;
}
